 import baseUrl from './config.js'
// 公共的请求
 const request = function(options) {
     options.url = baseUrl + options.url;
     try {
       const token = uni.getStorageSync('token');
       const account = uni.getStorageSync('account');
       if (token) {
         options.header = {
					 'content-type': 'application/x-www-form-urlencoded',
           'token' : token
         };
				 console.log("token");
        }else{
            uni.redirectTo({
                url: '/pages/login/login' 
            });
						console.log(options.url);
            return;
        }
     } catch (err) {
      console.log(err)
    }
    return uni.request(options);
  }
export default request;